# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=praeda
pkgver=49.b0b17d3
pkgrel=3
groups=('blackarch' 'blackarch-scanner')
pkgdesc='An automated data/information harvesting tool designed to gather critical information from various embedded devices.'
arch=('any')
url='https://github.com/percx/Praeda'
license=('GPL2')
depends=('perl' 'perl-io-socket' 'perl-net-ssleay' 'perl-net-snmp'
         'perl-netaddr-ip' 'perl-html-tableextract' 'perl-http-cookies'
         'perl-html-tagparser' 'perl-uri-fetch' 'perl-crypt-ssleay')
makedepends=('git')
source=("$pkgname::git+https://github.com/percx/Praeda.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/"{data,jobs}

  install -Dm 755 "$pkgname.pl" "$pkgdir/usr/share/$pkgname/$pkgname.pl"
  install -Dm 644 data/* "$pkgdir/usr/share/$pkgname/data/"
  install -Dm 644 jobs/* "$pkgdir/usr/share/$pkgname/jobs/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

